//
// Created by wangjunjun on 2024/2/6.
//

#ifndef KEYBOARDMANGER_H
#define KEYBOARDMANGER_H
#include <QWidget>
#include <QApplication>
#include <QKeyEvent>
#include <QWidget>
#include <QTimer>
#include <QObject>
#define  Speed_Max 3

class KeyBoardManger : public QObject{
Q_OBJECT
public:
    explicit KeyBoardManger(QObject *parent = nullptr);

protected:

    //param：统计按键按下次数
    void countKeys();
    //统计键盘的信息状态
    void onCountKeysMsg();
    //param[in] event:键盘按键按下触发事件，按键包括长按和短按
    //param[in] event:键盘按键按下触发事件，按键包括长按和短按
//    void keyPressEvent(QKeyEvent *event) override;
//    //param[in] event:键盘按键弹起触发事件
//    void keyReleaseEvent(QKeyEvent *event) override;
    bool eventFilter(QObject *obj, QEvent *event) override;
signals:
    //发送信号键盘按下的信号
    void SenKeyMsg( QString  Msg);
private:
    QTimer *timer;
    int upCount = 0;
    int downCount = 0 ;
    int leftCount = 0;
    int rightCount = 0;
};


#endif //WRTELEMTRY_KEYBOARDMANGER_H
